//
//  FLService.m
//  FruitsWholesaler
//
//  Created by sgone-2 on 16/4/21.
//  Copyright © 2016年 sgone. All rights reserved.
//

#import "FLService.h"
#import "Common.h"
#import "DataSingleton.h"
@implementation FLService


- (void)getShareListByCur_page:(NSString *)cur_page cur_size:(NSString *)cur_size success:(GetShareListSuccessBlock)successBlock error:(GetShareListErrorBlock)errorBlock {
    
    
    NSString *url = [NSString stringWithFormat:@"%@get_fruit_frend_list",SERVER_ADDRESS3];
    NSDictionary *dic = @{@"cur_page" : cur_page , @"cur_size" : cur_size};
    [self sendHttpRequest:url parameters:dic success:^(id returnValue) {
        
        successBlock ((NSArray *)returnValue[@"list"]);
        
//        successBlock ((NSString *) returnValue[@"error_flag"]);
        
    } error:^(NSString *errorInfo) {
        
        errorBlock (errorInfo);
        
//        NSLog(@"dashdasd  %@",errorInfo);
//        
        
    }];
}



- (void)getShareDetailsByCur_page:(NSString *)cur_page cur_size:(NSString *)cur_size id:(NSString *)share_id success:(GetShareDetailsSuccessBlock)successBlock error:(GetShareDetailsErrorBlock)errorBlock {
    
    NSString *url = [NSString stringWithFormat:@"%@get_fruit_frend_list",SERVER_ADDRESS3];
    
    NSDictionary *dic = @{@"cur_page":cur_page,@"cur_size":cur_size,@"fid":share_id};
    
    [self sendHttpRequest:url parameters:dic success:^(id returnValue) {
        
        successBlock((NSArray *)returnValue[@"list"]);
        
    } error:^(NSString *errorInfo) {
        
        errorBlock(errorInfo);
    }];
}


- (void)SetShareMessageByBody:(NSString *)body imglist:(NSString *)imglist lat:(NSString *)lat lng:(NSString *)lng user_type:(NSString *)user_type success:(SetShareMessageSuccessBlock)successBlock error:(SetShareMessageErrorBlock)errorBlock {
    

    
    
    
    
    NSString *url = [NSString stringWithFormat:@"%@add_fruit_frend_list",SERVER_ADDRESS3];
    
    NSDictionary *dic = @{@"tel":[[NSUserDefaults standardUserDefaults] objectForKey:@"phone"],@"uid":[[NSUserDefaults standardUserDefaults] objectForKey:@"wId"],@"body":body,@"imglist":imglist,@"lat":lat,@"lng":lng,@"user_type":user_type};
    
    [self sendHttpRequest:url parameters:dic success:^(id returnValue) {
        
        successBlock(@"success");
        
    } error:^(NSString *errorInfo) {
        
        errorBlock(errorInfo);
    }];
}






@end
